我正在尝试为jsdt找到eclipse的jar存储库

问题描述 投票:0回答:2

为了处理项目,我试图找到一个可靠的存储库,其中jsdt核心文件可用。

虽然'org.eclipse.jdt:org.eclipse.jdt.core:3.14.0'非常容易找到,但我的Gradle构建的jsdt看起来并不一样。我需要一些webtools。

当我下载eclipse时,我可以在里面找到jar,我能够找到组和神器ID。但不是声明依赖项的存储库。

我找到了Jabylon和Alfresco,但它们是从2013年开始的,我还从2007年发现了一个其他名称。但我试图找到他们实际放置这些罐子的地方,以便能够在当前版本中进行选择。

这是我正在寻找的包:Bundle-SymbolicName:org.eclipse.wst.jsdt.core它的组似乎是org.eclipse.webtools.jsdt.bundles

有任何想法吗?

java eclipse gradle jsdt
2个回答
1
投票

只有一些Eclipse插件JAR可以在Eclipse之外的普通(非OSGi)应用程序中使用,它们由Eclipse项目本身发布到Maven或Gradle存储库(例如Eclipse JGit)。

在Eclipse世界中,p2 repositories或包含OSGi包JAR的简单文件夹用于所谓的target platforms,以构建和运行Java OSGi应用程序。

你正在寻找的文物是e。 G。在latest simultaneous release update site但无法从Maven或Gradle访问。

请注意,某些Eclipse插件JAR仅在OSGi应用程序中工作(例如,在使用bundle激活器类时)或在基于Eclipse的应用程序中(例如,当使用Eclipse扩展点时)。


1
投票

为了将来的参考,我构建了一个快速脚本来将eclipse jar分类到一个存储库结构中,这样就可以部署,如果他们可以并拥有一个服务器。

import java.io.IOException;
import java.net.URI;
import java.nio.charset.StandardCharsets;
import java.nio.file.*;
import java.util.*;
import java.util.regex.*;

public final class DirToRepoStructure {

    private static final Pattern jarNamePattern = Pattern.compile( "(.*)_(\\d+\\.\\d+\\.\\d+)\\.v?(\\d+)\\.jar" );

    public static void main( String[] args ) throws IOException {

        Path root = Paths.get( args[ 0 ] );
        int rootNameCount = root.getNameCount( );

        String rootName = root.getFileName( )
                              .toString( );

        Path tempDir = Files.createTempDirectory( Paths.get( "." ), rootName );
        System.out.println( "using temporary directory: " + tempDir );

        Path achievePath = tempDir.getParent( )
                                  .resolve( rootName + ".zip" );
        System.out.println( "Archiving at: " + achievePath );

        DirectoryStream< Path > stream = Files.newDirectoryStream( root, "*.jar" );

        stream.forEach( jar -> {
            String fullName = jar.getFileName( )
                                 .toString( );

            System.out.println( fullName );
            Matcher matcher = jarNamePattern.matcher( fullName );

            if ( matcher.matches( ) ) {

                String jarName = matcher.group( 1 );

                String version = matcher.group( 2 );

                String snap = matcher.group( 3 );

                System.out.println( "reading: " + jarName + ", " + version );

                createJarStructure( tempDir, jar, jarName, version, snap );

            }
            else {
                throw new IllegalArgumentException( "file name does not match regex" );
            }

        } );

        try ( FileSystem zipFs = getZipFs( achievePath ) ) {

            Files.walk( tempDir )
                 .skip( rootNameCount )
                 .forEach( source -> copyIntoZip( zipFs, source, rootNameCount ) );
        }
    }

    private static void copyIntoZip( FileSystem zipFs, Path source, int rootNameCount ) {

        try {
            Path zipRoot = zipFs.getPath( "/" );

            int tempRootNameCount = rootNameCount + 1;
            int sourceNameCount = source.getNameCount( );

            String newPathName = source.subpath( tempRootNameCount, sourceNameCount )
                                       .toString( );

            Path pathInZipFile = zipRoot.resolve( newPathName );
            Files.copy( source, pathInZipFile, StandardCopyOption.REPLACE_EXISTING );
        }
        catch ( IOException e ) {
            throw new RuntimeException( e );
        }
    }

    private static void createJarStructure( Path tempDir, Path jar, String jarName, String version, String snap ) {

        try {

            Path jarRoot = jar.getParent( )
                              .resolve( jarName )
                              .resolve( version + "-SNAPSHOT" );

            Path jarDirectory = Files.createDirectories( tempDir.resolve( jarRoot ) );

            String shortSnap = snap.substring( 0,8 );
            Path jarTarget = jarDirectory.resolve( jarName + "-" + version + "-"+ shortSnap + ".jar" ); Files.copy( jar, jarTarget );

        }
        catch ( IOException e ) {
            throw new RuntimeException( e );
        }
    }

    private static FileSystem getZipFs( Path archivePath ) throws IOException {

        Map< String, String > env = new HashMap<>( );
        env.put( "create", "true" );
        env.put( "encoding", StandardCharsets.UTF_8.toString( ) );

        System.out.println( archivePath );
        URI uri = URI.create( "jar:file:" + archivePath.toAbsolutePath( ) );
        return FileSystems.newFileSystem( uri, env );

    }
}
© www.soinside.com 2019 - 2024. All rights reserved.